<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<h1>Cors解决跨域(复杂请求下的问题解决)</h1>
<button id="btn">跨域问题解决</button>
<script>
  const oBtn = document.querySelector('#btn')
  const myAxios = axios.create({
    baseURL: 'http://127.0.0.1:8090',
    timeout: 5000,
    headers: {
      token:'f56vas1d53,6k5u41563wesfb1,v16we85arh41es563r1'
    }
  })

  oBtn.onclick =async function () {
    const result =await myAxios.get(
      '/corsGet',{
        params:{
          userId:'001'
        }
      }
    )
    console.log(result)
  }
</script>
</body>
</html>